<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * 处理时间
 *
 */
class Timelib {
	//var $CI;
	function __construct()
	{
		//$this->CI = & get_instance();
	}
	
	function diff_time($time)
	{//echo $time.'<br />';
		$time_des = '';
		if($time < 60){
			$time_des .= $time .'秒前';
		}elseif ($time >= 60 && $time < 3600){
			$time_des .= intval($time/60) .'分钟前';
		}elseif ($time >= 3600 && $time < 86400){
			$time_des .= intval($time/3600) .'小时前';
		}elseif ($time >= 86400 && $time < 259200){
			$time_des .= intval($time/86400) .'天前';
		}elseif ($time >= 259200 && $time < 31104000){
			$time_des .= intval($time/259200) .'个月前';
		}else{
			$time_des .= intval($time/31104000) .'年前';
		}
		return $time_des;
	}
}